/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agilelang.main;

import java.util.Map;
import org.agilelang.generate.AgileGenerator;
import org.agilelang.generate.CreateStructure;
import org.agilelang.object.ObjectProject;
import org.agilelang.object.Read;
import org.agilelang.scanner.Scanner;

/**
 *
 * @author Roderick
 */
public class Main {
    //agilelang.jar -s syntax.xml -c config_java.xml -s source.agile -f files.xml

    String USERPROFILE = "";
    String TEMP = "";
    String USERDOMAIN = "";
    String arg_syntax = "";
    String arg_config = "";
    String arg_source = "";
    String arg_file = "";

    public void process(String args[]) {
        System.out.println("Welcome AgileLang 0.1 Beta, 2013");
        if (args.length > 0) {
            Map<String, String> env = System.getenv();
            for (String envName : env.keySet()) {
                switch (envName) {
                    case "USERPROFILE":
                        USERPROFILE = env.get(envName);
                        break;
                    case "TEMP":
                        TEMP = env.get(envName);
                        break;
                    case "USERDOMAIN":
                        USERDOMAIN = env.get(envName);
                        break;
                }
            }
            int l = args.length;
            for (int x = 0; x < l; x++) {
                String arg = args[x];
                switch (arg) {
                    case "-s":
                        x++;
                        arg_syntax = args[x];
                        new CreateStructure(arg_syntax);
                        break;
                    case "-c":
                        x++;
                        arg_config = args[x];
                        break;
                    case "-o":
                        x++;
                        arg_source = args[x];
                        break;
                    case "-f":
                        x++;
                        arg_file = args[x];
                        break;
                }
            }
        } else {
            System.out.println("Error : config not found");
        }
    }
    
    public void execute(){        
        Read rd = new Read();
        ObjectProject agileproject = rd.process(arg_syntax);
        //Scanner dosPrueba1 = new Scanner(arg_source, agileproject, "out.xml");
        //----------------------------------------------------------------------
        AgileGenerator ag = new AgileGenerator();
        //ag.process( "out.xml",  "folder/tpl",  "out",  arg_config) ;
        
    }

    public static void main(String args[]) {
        //-create structure.xml
        Main main = new Main();
        main.process(args);

    }
}
